package com.wbt.bambootown.mvp.presenter;


import com.wbt.bambootown.entity.CameraPic;
import com.wbt.bambootown.mvp.contract.CameraPicContract;
import com.wbt.bambootown.mvp.contract.LoginContract;
import com.wbt.bambootown.mvp.frame.ActivityPresenter;
import com.wbt.bambootown.mvp.model.CameraPicModel;
import com.wbt.bambootown.mvp.model.LoginModel;
import com.wbt.bambootown.rx.FilterSubscriber;

import java.util.List;

public class CameraPicPresenter extends ActivityPresenter<CameraPicModel,CameraPicContract.View> implements CameraPicContract.Presenter{
    public static final String TAG = "CameraPicPresenter";

    @Override
    public void getCameraPic(int id, String beginTime, String endTime, int pageIndex , int pageCount) {
        addSubscription(getModel().getCameraPic(id, beginTime, endTime, pageIndex , pageCount), new FilterSubscriber<List<CameraPic>>() {
            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().showError(errorMsg);
            }

            @Override
            public void onNext(List<CameraPic> cameraPics) {
                getView().showPicSuccess(cameraPics);
            }
        });
    }
}
